import 'package:flutter_axrjc/datasource/network/bean/NoticeBean.dart';
import 'package:flutter_axrjc/datasource/network/request/network_service.dart';

class MomentApi {
  static Future<List<NoticeBean>> getNotice(
      {required String remindType, required int page}) async {
    var res = await NetworkService.post(
        url: 'app/proBaseRemindQuery.do',
        map: {
          "limit": '10',
          "offset": '$page',
          "remindType": remindType, //0灯具检测提醒，1休息提醒，2护眼操提醒
        },
        showLoading: false);
    return res.getTypedList<NoticeBean>((map) => NoticeBean.fromJson(map)) ??
        [];
  }

  static addNotice({
    required String ifRepeat,
    required String remindType,
    required String name,
    required String remindTime,
    required String remindStatus,
  }) async {
    await NetworkService.post(
        url: 'app/proBaseRemindSave.do',
        map: {
          "ifRepeat":
              ifRepeat, //是否重复提醒；0每天提醒，1周一提醒，2周二提醒，3周三提醒，4周四提醒，5周五提醒，6周六提醒，7周天提醒
          "remindLable": name,
          "remindType": remindType, //0灯具检测提醒，1休息提醒，2护眼操提醒
          "remindTime": remindTime, //0灯具检测提醒，1休息提醒，2护眼操提醒
          "remindStatus": remindStatus, //0启用，1停用
        },
        showLoading: false);
  }

  // static Future<AdviceBean?> getAdvice({required String remark}) async {
  //   var res = await NetworkService.post(
  //       url: "app/processSysCodeView",
  //       map: {"limit": "10", "offset": "1", "remark": remark},
  //       showLoading: false);
  //   return res.getTypedData((map) => AdviceBean.fromJson(map));
  // }
}
